{extends file="../acp.html"}

{block name="title"}{$head_title}{/block}
{block name="content"}
<form id="J_FormArticle" action="" method="post">
    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>时间：</label>
        <div class="mgt10">
            <div class="form-controls">
                <!--  <span class="tbs-txt">添加时间：</span>-->
                <input type="text" autocomplete="off" class="Wdate" name="addtime" value="{if $info.addtime}{$info.addtime|date_format:'%Y-%m-%d %H:%M'}{else}{/if}"  onclick="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm'})">
            </div>
        </div>
    </div>


    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>地点：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge" name="address" id="address" value="{$info.address}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>我方人员：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge" name="our_staff" id="our_staff" value="{$info.our_staff}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>企业名称：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge" name="company_name" id="company_name" value="{$info.company_name}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>对方人员：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge" name="their_staff" id="their_staff" value="{$info.their_staff}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name"><span class="colorRed">*</span>联系方式：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge" name="link_way" id="link_way" value="{$info.link_way}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>


    <div class="formitems inline">
        <label class="fi-name">
            <span class="colorRed">*</span>跟进状态：</label>
        <div class="form-controls">
            <select name="follow_state" onchange="check_state();">
                <option value="-1">--请选择--</option>
                {foreach from=$follow_state_list item=item key = key}
                <option value="{$key}">{$item}</option>
                {/foreach}
            </select>
            <span class="fi-help-text error">选择客户流失后,将不能添加沟通纪要,谨慎选择!</span>
        </div>
    </div>

    <div class="formitems inline" style="display: none;" id="is_drain_why">
        <label class="fi-name">
            <span class="colorRed">*</span>流失原因：</label>
        <div class="form-controls">
            <select name="drain_why">
                <option value="-1">--请选择--</option>
                {foreach from=$drain_list item=item key = key}
                <option value="{$item.type_id}">{$item.type_name}</option>
                {/foreach}
            </select>
            <span class="fi-help-text error"></span>
        </div>
    </div>


    <div class="formitems inline">
        <label class="fi-name">项目情况：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge" name="project_detail" id="project_detail" value="{$info.project_detail}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name">入住需求：</label>
        <div class="form-controls">
            <input type="text" placeholder="" class="xlarge" name="enter_need" id="enter_need" value="{$info.enter_need}">
            <span class="fi-help-text hide"></span>
        </div>
    </div>

    <div class="formitems inline">
        <label class="fi-name">备注：</label>
        <div class="form-controls">
            <textarea placeholder="" class="xlarge" name="remark" id="remark">{$info.remark}</textarea>
            <span class="fi-help-text hide"></span>
        </div>
    </div>

<div class="formitems inline">
    <label class="fi-name"></label>
    <div class="form-controls">
        <input type="hidden" name="act" value="{$act}" />
        <input type="hidden" name="customer_id" value="{$customer_id}" />
        <input type="hidden" name="talk_summary_id" value="{$talk_summary_id}" />
        <button type="submit" class="btn btn-blue"><i class="gicon-check white"></i>保存</button>
    </div>
</div>
</form>
{/block}
{block name="js"}
<script src="/Public/Plugins/My97DatePicker/WdatePicker.js?version={$version}"></script>
<script type="text/javascript" src="/Public/Js/front/front_js/ajaxupload.3.5.js"></script>
{literal}
<script>
    function add_file() {
        new AjaxUpload("#file", {
            action: "/Acp/uploadFileHandler",
            name: "upfile",
            responseType: "json",
            onSubmit: function(){
                //alert('正在上传');
                //preview处的图片改为loading图片
                /*$('.preview-plan').show();
                 if($("#upload-plan").siblings('.preview-plan').find('img').length>=3){
                 alert("最多上传3张图片");
                 return false;
                 }*/
            },
            onChange: function(file, extension){
                if (extension && /^(doc|docx|pdf)$/.test(extension)) {
                    return true;
                }
                else {
                    alert('暂不支持该文件格式')
                    return false;
                }
            },
            onComplete: function(file, response){
//              console.log(response);
                console.log(file);
                if (response.status === 0) {
                    alert(response.msg);
                    location.reload();
                }
                else if (response.status === 1) {

//                    $.ajax({
//                        type:'post',
//                        url:'/AcpIncubatorOrder/incubator_prospectus',
//                        data:{id:order_id,url:response.img_url},
//                        success:function (data) {
//                            if(data.code==1){
//                                alert(data.msg);
//                            }else{
//                                alert(data.msg);
//                            }
//                        }
//                    })
                }
            }
        });
    }


     function check_state() {

        var follow_state = $("select[name='follow_state']").val();
        console.log(follow_state);
        if(follow_state == 5){

            $("#is_drain_why").show();

        }else{
            $("#is_drain_why").hide();
            $("select[name='drain_why']").val('');
        }
     }







</script>
{/literal}
{/block}